if(!jsx3.lang.Class.forName("tibco.admin.deployment.sa.su.SUDetail")) {
    jsx3.lang.Class.defineClass(
            "tibco.admin.deployment.sa.su.SUDetail", // full name of the class to create
            jsx3.lang.Object,
            [tibco.admin.plugin.PluginContainerInterface],
            function (plugin) {
                plugin.instance = null;
                plugin.prototype.block = null;

                plugin.getInstance = function() {
                    if(!this.instance) {
                        this.instance = new tibco.admin.deployment.sa.su.SUDetail();
                        this.instance.subscribeAll();
                    }
                    return this.instance;
                }

                plugin.prototype.onAfterGetPlugins = function() {
                    var iter = this.getPluginList().iterator();
                    while(iter.hasNext()) {
                        var obj = iter.next();
                        var tab = this.tabbedpane.addTab(obj.getTabText());
                        obj.loadComponent(tab.getContentPane());
                    }
                    if(this.suSelectedEvent) {
                        var objEvent = this.suSelectedEvent;
                        delete this.suSelectedEvent;
                        this.suSelected(objEvent);
                    }
                }

                plugin.prototype.findTab = function(name) {
                    var arr = this.tabbedpane.getTabPane().getChildren();
                    for(var item in arr) {
                        var obj = arr[item];
                        try {
                        if(obj.getText() == name) {
                            return obj;
                        }
                        } catch(ex) {
                        }
                    }
                    return null;
                }

                plugin.prototype.suSelected = function(objEvent) {
                    try {
                        if(this.tabbedpane && (this.tabbedpane.getTabPane().getChildren().length > 0)) {
                            var type = objEvent.type;
                            if(type) {
                                this.block.setDisplay(jsx3.gui.Block.DISPLAYBLOCK, true);
                                var iter = this.getPluginList().iterator();
                                var tab1 = null;
                                var selectTab1 = false;
                                while(iter.hasNext()) {
                                    try {
                                        var obj = iter.next();
                                        var findText = obj.getTabText();
                                        var tab = this.findTab(findText);
                                        if(!tab1) {
                                            tab1 = tab;
                                        }
                                    var filter = obj.getSupportedTypes();
                                    if(!filter || filter.contains(type)) {
                                        // show tab
                                        if(tab.getDisplay() != jsx3.gui.Block.DISPLAYBLOCK) {
                                            tab.setDisplay(jsx3.gui.Block.DISPLAYBLOCK, true);
                                        }
                                    }
                                    else {
                                        //hide tab
                                        if(this.tabbedpane.getSelectedTab() == tab) {
                                            selectTab1 = true;
                                        }
                                        if(tab.getDisplay() != jsx3.gui.Block.DISPLAYNONE) {
                                            tab.setDisplay(jsx3.gui.Block.DISPLAYNONE, true);
                                        }
                                    }
                                    } catch(ex) { // show if there's an error
                                        if(tab.getDisplay() != jsx3.gui.Block.DISPLAYBLOCK) {
                                            tab.setDisplay(jsx3.gui.Block.DISPLAYBLOCK, true);
                                        }
                                    }
                                }
                                if(selectTab1) {
                                    tab1.select();
                                }
                            }
                            else {
                                this.block.setDisplay(jsx3.gui.Block.DISPLAYNONE, true);
                            }
                        }
                        else {
                            this.suSelectedEvent = objEvent;
                        }
                    }
                    catch(ex) {
                        tibco.admin.Main.logException(ex);
                    }
                }

                plugin.prototype.setupPlugin = function(childPlugin) {
                }

                plugin.prototype.initPlugin = function(obj) {
                }

                plugin.prototype.loadDetails = function() {
                    if(this.getPluginList().size() == 0) {
                        var preLoad = new jsx3.util.List(0);
                        if(!jsx3.lang.Class.forName("tibco.admin.deployment.sa.su.nodeMap.NodeMap")) {
                            try {
                                tibco.admin.Main.loadClass("tibco/admin/deployment/sa/su/nodeMap/nodeMap.js", "tibco.admin");
                                preLoad.add(tibco.admin.deployment.sa.su.nodeMap.NodeMap, preLoad.size());
                            }
                            catch(ex) {
                                tibco.admin.Main.logException(ex);
                            }
                        }
                        else {
                            preLoad.add(tibco.admin.deployment.sa.su.nodeMap.NodeMap, preLoad.size());
                        }
                        if(!jsx3.lang.Class.forName("tibco.admin.deployment.sa.subVar.SubVar")) {
                            try {
                                tibco.admin.Main.loadClass("tibco/admin/deployment/sa/subVar/subVar.js", "tibco.admin");
                                preLoad.add(tibco.admin.deployment.sa.subVar.SubVar, preLoad.size());
                            }
                            catch(ex) {
                                tibco.admin.Main.logException(ex);
                            }
                        }
                        else {
                            preLoad.add(tibco.admin.deployment.sa.subVar.SubVar, preLoad.size());
                        }

                        var iter = preLoad.iterator();
                        this.loadPlugins("tibco.admin.deployment.sa.su.SUDetailInterface", preLoad);
                    }
                    else {
                        this.onAfterGetPlugins();
                    }
                }

                plugin.prototype.subscribeAll = function() {
                    var me = this;
                    tibco.admin.PubSub.subscribe(tibco.admin.deployment.sa.su.sulist.EventID.SERVICEUNIT_ROW_SELECTED, me, me.suSelected);
                };

                plugin.prototype.unsubscribeAll = function() {
                    tibco.admin.PubSub.unsubscribe(tibco.admin.deployment.sa.su.sulist.EventID.SERVICEUNIT_ROW_SELECTED, this);
                }

                /*
                * MUST appear in "onAfterDeserialize" textarea.
                * @Param: objJSX {jsx3.gui.Object} the root JSX Object of current Component.
                */
                plugin.prototype.onAfterDeserialize = function(objJSX) {
                    this.block = objJSX;
                    var me = this;
                    this.block.handler = me;
                    this.tabbedpane = this.block.getDescendantOfName("tabbedpane_400");
                    this.loadDetails();
                }

                plugin.prototype.beginEdit = function(obj) {
                    var me = this;
                    this.handler.containerBeginEdit(me);
                }

                plugin.prototype.endEdit = function(obj) {
                    if(!this.isInEditMode()) {
                        var me = this;
                        this.handler.containerEndEdit(me);
                    }
                }

                plugin.prototype.getPluginInitArgs = function() {
                    return ["ServiceUnitDetail","true"];
                }

                plugin.prototype.getComponentPath = function() {
                    return  "tibco/admin/deployment/sa/su/component.xml"
                }

                plugin.prototype.onRefresh = function() {
                    var tabText = this.tabbedpane.getSelectedTab().getText();
                    var iter = this.getPluginList().iterator();
                    while(iter.hasNext()) {
                        var obj = iter.next();
                        if(obj.getTabText() == tabText) {
                            obj.tabSelected();
                            break;
                        }
                    }
                }
            }
            );
}